﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using log4net;
using log4net.Config;
using Ninject.Modules;
using Quartz;
using Topshelf;
using Topshelf.Ninject;
using Topshelf.Quartz;
using Topshelf.Quartz.Ninject;
using Dln.Handler;
using Dln.Model;
using Dln.Common;
using Dln.Common.Helper;


namespace AutoRun
{
    public class DutyAction : IJob
    {
        public void Execute(IJobExecutionContext context)
        {
            var week = DateTime.Now.DayOfWeek.ToString();


            var dutyList = SqlHelper.Context.From<Duty>().ToList();
            if (dutyList != null && dutyList.Count() > 0)
            {
                foreach (var item in dutyList)
                {
                    if (item.WeekDay == week)
                    {
                        MessageHelper.ProblemNotice(item.Openid,
                                   "信息科值日",
                                 DateTime.Now.ToString(),
                                  "信息科值日",
                                  string.Format("早{0}，今天上班记得值日哦", item.Name),
                                   ""
                               );
                    }

                }
            }


        }
    }
}
